package ezXpns.tests;

import static org.junit.Assert.*;

import org.junit.Test;

import ezXpns.BudgetChange;


//@author A0088827L
public class TagTest {
	@Test
	public void test() {
		BudgetChange budgetChange = new BudgetChange();
		
		budgetChange.setTagsFromString("sale gift size: 4 color:blue:at:::: Bedok:: color: red: : ::trailing:");
		assertTrue(budgetChange.hasTag("sale"));
		assertTrue(budgetChange.hasTag("trailing"));
		assertTrue(budgetChange.hasTag("gift"));
		assertTrue(budgetChange.hasTag("color"));
		assertTrue(budgetChange.hasTag("at"));
		assertFalse(budgetChange.hasTag("Bedok"));
		assertFalse(budgetChange.hasTag("blue"));
		assertFalse(budgetChange.hasTag("red"));
		assertEquals("red", budgetChange.getTag("color").getValueAsString());
		assertEquals("Bedok", budgetChange.getTag("at").getValueAsString());
		assertEquals(4.0f, budgetChange.getTag("size").getValueAsNumber(), 0.0001f);
		assertEquals("sale gift size:4 at:Bedok color:red trailing", budgetChange.getTagsAsString());
	}
}
